﻿using System;

namespace Problem002
{
    class Program
    {
        private static readonly double MaxTermValue = 4000000;
        private static readonly Func<double, bool> evenValue = x => (0 == x%2);

        static void Main()
        {
            double sum = 0;

            for (double term = Fibonacci.NextTerm; term < MaxTermValue; term = Fibonacci.NextTerm)
            {
                if (evenValue(term))
                    sum += term;
            }

            Console.WriteLine("Sum: {0}", sum);
            Console.ReadKey();
        }
    }
}
